Release 10.1A: OpenEdge Development:
Progress 4GL Reference


= Assignment operator

Assigns the value of an expression to a database field or variable.

Data movement

Syntax

field = expression [ NO-ERROR ] 

field

The name of a database field or variable to which you want to assign the value of the expression. If the field is an array, and you do not name a particular element, Progress stores expression in each element of the array. If you name a particular element, Progress stores expression in that element.

The left side of an assignment can also be an attribute or Progress keyword (such as ENTRY, FRAME-VALUE, SUBSTRING, or OVERLAY).

expression

An expression with a data type that is consistent with the data type of the field. If field is integer and expression is decimal, then Progress rounds the value of the expression before assigning it. If field is decimal and expression is decimal, then Progress rounds the value of the expression to the number of decimal places defined for the field in the Dictionary or defined or implied for a variable.

NO-ERROR

Suppresses any errors that occur as a result of the operation. After the assignment completes, you can check the ERROR-STATUS system handle for information about any errors that might have occurred.

If you do not specify this option and an error occurs, the assignment is canceled and any changes to field values within the assignment are undone. If the assignment occurs within a transaction, any changes to variables, work table fields, and temporary table fields are also undone, unless you define the variable or field with the NO-UNDO option.

Example

This procedure resets all the monthly quota values to 0 in all salesrep records. If you want to set values for individual array elements, you can do so by making an explicit assignment using the assignment statement and a specific array reference, such as month-quota[1] or month-quota[i].

r-asgmnt.p
DEFINE VARIABLE ctr   AS INTEGER.

FOR EACH salesrep:
  DO ctr = 1 TO 12:
    salesrep.month-quota = 2500.
  END.
END. 

Notes

See also

ASSIGN statement, Data types, COPY-LOB statement, FIX-CODEPAGE function


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095